<template>
<!--风险登记-->
  <div class="fxdj">
    <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="60px">
      <div class="form-small-title" style="margin-top: 20px;">
        <el-divider direction="vertical" class="form-divider"></el-divider>
        <span class="form-small-font">基本信息</span>
      </div>
      <el-row style="margin-top: 25px">
        <el-col :span="12">
          <el-form-item label="风险名称：" label-width="90px">
            <el-input v-model="ruleForm.fxmc" placeholder="请输入" :readonly="status==='read'"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="风险类型：" label-width="90px">
            <el-select v-model="ruleForm.fxlx" placeholder="请选择">
              <el-option v-for="item in riskTypesOptions" :key="item.value" :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="风险状态：" label-width="90px">
            <el-select v-model="ruleForm.fxzt" placeholder="请选择">
              <el-option v-for="item in riskStateOptions" :key="item.value" :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="6">
          <el-form-item label="负责人：" label-width="90px">
            <el-input v-model="ruleForm.fzr" placeholder="请输入" suffix-icon="el-icon-user" :readonly="status==='read'"></el-input>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="预计发生：" label-width="90px">
            <el-date-picker
              v-model="ruleForm.yjfs"
              type="date"
              placeholder="选择日期"
              :readonly="status==='read'"
              style="width: 100%">
            </el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="项目名称：" label-width="90px" >
            <el-input v-model="ruleForm.xmmc" placeholder="请输入" :readonly="status==='read'"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-form-item label="风险描述：" label-width="90px">
          <el-input v-model="ruleForm.miaoshu" placeholder="请输入" :readonly="status==='read'"></el-input>
        </el-form-item>
      </el-row>
      <div class="form-small-title">
        <el-divider direction="vertical" class="form-divider"></el-divider>
        <span class="form-small-font">风险分析</span>
      </div>
      <el-row style="margin-top: 25px">
        <el-col :span="6">
          <el-form-item label="发生概率：" label-width="90px">
            <el-select v-model="ruleForm.fsgl" placeholder="请选择">
              <el-option v-for="item in probabilityOptions" :key="item.value" :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="影响程度：" label-width="90px">
            <el-select v-model="ruleForm.yxcd" placeholder="请选择">
              <el-option v-for="item in incidenceOptions" :key="item.value" :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="风险等级：" label-width="90px">
            <el-select v-model="ruleForm.fxdj" placeholder="请选择">
              <el-option v-for="item in riskLevelOptions" :key="item.value" :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
        <el-col :span="6">
          <el-form-item label="应对策略：" label-width="90px">
            <el-select v-model="ruleForm.ydcl" placeholder="请选择">
              <el-option v-for="item in strategyOptions" :key="item.value" :label="item.label"
                         :value="item.value"></el-option>
            </el-select>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-form-item label="应对措施：" label-width="90px">
          <el-input v-model="ruleForm.cuoshi" placeholder="请输入" :readonly="status==='read'"></el-input>
        </el-form-item>
      </el-row>
    </el-form>
  </div>
</template>

<script>
export default {
  name: "fxdj",
  data(){
    return{
      ruleForm: {},
      rules: {},
      riskTypesOptions: [],
      riskStateOptions:[],
      probabilityOptions:[],
      incidenceOptions:[],
      riskLevelOptions:[],
      strategyOptions:[]
    }
  },
  props:{
    status:{
      type: String,
      default: 'edit'
    },
    selectRow:{
      type: Object,
      default: ()=>{}
    }
  },
  watch:{
    selectRow:{
      handler(val) {
        if(this.selectRow){
          this.ruleForm.xmmc = this.selectRow.projectName
          this.ruleForm.yjfs = this.selectRow.start
          this.ruleForm.fxmc = this.selectRow.riskName
          this.ruleForm.fxlx = this.selectRow.riskType
          this.ruleForm.fxdj = this.selectRow.riskLevel
          this.ruleForm.fxzt = this.selectRow.riskStatus
        }
      },
      immediate: true,
    }
  }
}
</script>

<style scoped lang="scss">
.fxdj ::v-deep{
  .el-input__inner {
    border: 0 !important;
    border-bottom: 1px solid #DCDFE6 !important;
    border-radius: 0 !important;
    padding-right: 20px !important;
  }
}

.form-small-title {
  border-bottom: solid 2px #C0C4CC;
  padding-bottom: 10px;
}

.form-divider {
  width: 5px;
  height: 26px;
  background: rgb(66, 185, 131);
}

.form-small-font {
  font-size: 19px;
  font-weight: 600;
  color: #303133;
}
</style>
